var app = new Vue({
    el: "#app",
    data: {
        form: {
            ywx: "",        //英文姓
            ywm: "",        //英文名
            zwxm: "",         //中文姓名
            jnlxdh: "",        //境内联系电话，申请人电话
            gjdq: "ABW",          //国家地区
            csrq: "2000-01-01",
            csd: "ABW",
            xb: "1",
            jnjzdxxdz: "",     //境内居住地详细地址(在华住址)
            dbr: "",            //代办人：联系人姓名
            dbrlxdh: "",       //代办人联系电话：联系人电话
            xczjzl: "14",          //现持证件种类：护照类型
            xczjhm: "",          //现持证件号码：护照号码
            xczjyxqz: "",          //现持证件有效期至：护照有效期至
            xcqzzl: "",
            xcqzhm: "",          //现持签证号码
            xcqzyxqz: "",        //现持签证有效期至
            xctlyxqz: "",         //现持停留有效期至
            sqlb: "",
            sqqzzl: "",
            jlxksy: "",
            bzlx: "",
            qzyxqz: null
        },
        gjdqOptions: gjdqOptions,
        csdOptions: csdOptions

    }, created: function () {

        this.form = apply;
    },
    computed: {
        gjdqName: function () {
            return getValue(gjdqOptions, this.form.gjdq);
        }, csdName: function () {
            return getValue(csdOptions, this.form.csd);
        },
        xbName: function () {
            if (this.form.xb == '1') {
                return "男";
            }
            else {
                return "女";
            }
        },
        xczjzlName: function () {
            if (this.form.xczjzl == '14') {
                return "普通护照";
            }
            else if (this.form.xczjzl == '11') {
                return "外交护照";
            }

            else if (this.form.xczjzl == '12') {
                return "公务护照";
            }
            else {
                return "其他";
            }
        },
        xcqzzlName: function () {
            return getValue(xcqzzlOptions, this.form.xcqzzl);
        },
        sqlbName: function () {
            return getValue([{key: "202", value: "普通签证"}, {key: "207", value: "停留证件"}, {
                key: "205",
                value: "居留许可"
            }], this.form.sqlb);
        },
        bzlxName: function () {
            return getValue([{key: "W1", value: "申请"}, {key: "W2", value: "延期"}, {key: "W3", value: "换发"}, {key: "W4", value: "补发"}], this.form.bzlx);
        },
        sqqzzlName: function () {
            return getValue([
                {key: "F", value: "访问"},
                {key: "L", value: "旅游"},
                {key: "M", value: "贸易"},
                {key: "Q2", value: "团聚"},
                {key: "J2", value: "记者"},
                {key: "S2", value: "私人事务"},
                {key: "X2", value: "学习"},
                {key: "R", value: "人才"},
                {key: "G", value: "过境"},
                {key: "C", value: "乘务"},
                {key: "3T", value: "团签"}
            ], this.form.sqqzzl);
        },
        jlxksyName:function(){
            return getValue(this.jlxksyOptions,this.form.jlxksy);
        },

        xcqzDisplay: function () {
            if (this.form.xcqzzl == 'V' || this.form.xcqzzl == 'M' || this.form.xcqzzl == '' || this.form.xcqzzl == 't') {
                return true;
            }
            else {
                return false;
            }
        },
        sqqzDisplay: function () {
            if (this.form.sqlb == '202') {
                return false;
            }
            else {
                return true;
            }
        },
        sqtlDisplay: function () {
            if (this.form.sqlb == '207' || this.form.sqlb == '205') {
                return false;
            }
            else {
                return true;
            }
        },

        sqlb: {
            set: function (newValue) {
                this.form.sqlb = newValue;
                this.form.sqqzzl = "";
                this.form.jlxksy = "";
            },
            get: function () {
                return this.form.sqlb;
            }
        },

        jlxksyOptions: function () {
            if (this.form.sqlb == '207') {
                return [{key: "31", value: "免签"}, {key: "32", value: "船员"}, {key: "33", value: "退籍"}, {
                    key: "34",
                    value: "人道主义"
                }, {key: "99", value: "其他"}]
            }
            if (this.form.sqlb == '205') {
                return [{key: "03", value: "工作"}, {key: "07", value: "学习"}, {key: "05", value: "记者"}, {
                    key: "14",
                    value: "团聚"
                }, {key: "15", value: "私人事务"}]
            }
            return [];
        },
        bzlbOptions: function () {
            if (this.form.sqlb == '202') {
                this.form.bzlx = 'W2';
                return [{key: "W2", value: "延期"}, {key: "W3", value: "换发"}, {key: "W4", value: "补发"}];
            }
            if (this.form.sqlb == '205') {
                this.form.bzlx = 'W1';
                return [{key: "W1", value: "申请"}, {key: "W2", value: "延期"}, {key: "W3", value: "换发"}, {
                    key: "W4",
                    value: "补发"
                }];
            }
            if (this.form.sqlb == '207') {
                this.form.bzlx = 'W1';
                return [{key: "W1", value: "申请"}, {key: "W3", value: "换发"}, {key: "W4", value: "补发"}];
            }
        },
        jlxksyTitle: function () {
            if (this.form.sqlb == '205') {
                return '申请居留事由';
            }
            else {
                return '申请停留事由';
            }
        },
        sqlbOptions: function () {
            if (this.form.xcqzzl == 'M' || this.form.xcqzzl == 'V') {
                this.form.sqlb = '207';
                return [{key: "207", value: "停留证件"}];
            }
            else {
                return [{key: "202", value: "普通签证"}, {key: "207", value: "停留证件"}, {key: "205", value: "居留许可"}];
            }

        }
    },
    methods: {}
});